home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 14142 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.0 KB

  1. Path: news.bright.net!news
  2. From: e <drtypair@bright.net>
  3. Newsgroups: comp.lang.c++
  4. Subject: C++ input question
  5. Date: 29 Mar 1996 04:32:48 GMT
  6. Organization: BrightNet Ohio
  7. Message-ID: <4jfp5g$7tc@cletus.bright.net>
  8. NNTP-Posting-Host: akro1-cs-3.dial.bright.net
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 1.1 (Windows; I; 16bit)
  13.  
  14. ok I'm not really sure what you guys handle on thie newsgroup but I'm 
  15. grasping at staws
  16.  
  17. I have exactly 30 minutes(it's going to be late) to turn in a program for 
  18. my data structures and algorithms I course( yes I am a baby to this)
  19.  
  20. here's my problem:
  21.  
  22. I have an input structure:
  23.  
  24. int itemp,ptemp;
  25. while(cin.peek()!=EOF){    //I know this is wrong, peek returns an int
  26.    cin>>itemp;
  27.    cin.ignore (3); 
  28.    cin>>ptemp;
  29.    reg[r][ptemp]=itemp;
  30. }
  31.  
  32. that has to input a preset input structure:
  33.  
  34. <register><space><polynomial>
  35. ex.
  36.   2 3 x^4+1 x^3+5 x^0+12 x^1
  37.  
  38. the problem:
  39.    is there a way to determine where the end of an input in(i.e. how do I 
  40. know I hit the ....^1(carriage return) )????
  41.  
  42.    I know there must be a way to find the end, and I NEED it or else my 
  43. loop never ever ends
  44.  
  45.  
  46.    Now if the answer is simple, keep two things in mind:
  47.  1) this is only my second semester of c++
  48.  
  49.  2) I am currently going crazy becuase of this program(well I do for all 
  50.        of them as a matter of fact)
  51.  
  52. If anyone has any solution or even the slightest push in the right 
  53.   direction, AND has it by 3/29/96, Friday, tomorrow 
  54.         please mail me:
  55.  
  56.    send enlightenment to:
  57.    r3egk@vm1.cc.uakron.edu
  58.             AND    (if not to much of a bother)
  59.    aa746@freenet.akron.oh.us
  60.  
  61. thanx in advance for anything I get.....................I need COFFEE!!
  62.  
  63.  
  64.  
  65. p.s.    I want to see if anyone else out there gets this
  66.  
  67. (for those of us still in school)
  68. The answer for all unaswerable computer science lab questions:
  69.    this is a square  O.
  70.         --Chico
  71. I can't explain it, but it seems to make some sense...or am I just crazy
  72.  
  73.